<link rel="import" href="../../bower_components/polymer/polymer-element.html">

<dom-module id="event-demo">
  <template>
    <style>
       :host {
        display: block;
      }

    </style>
    <div>
      这是内容
    </div>
  </template>

  <script>
    /**
     * @EventDemo
     * @polymer
     */
    class EventDemo extends Polymer.Element {
      static get is() {
        return 'event-demo';
      }
      ready(){
          super.ready();
          this.addEventListener("mouseenter",this.handlerMouseEnter);
          this.addEventListener("mouseout",this.handlerMouseOut)
      }
      handlerMouseEnter(e){
          e.target.style.backgroundColor = "#f00";
      }
      handlerMouseOut(e){
          e.target.style.backgroundColor = "#fff";
      }
      disconnectedCallback(){
          super.disconnectedCallback();
          this.removeListeners("mouseenter");
          this.removeListeners("mouseout");
      }
    }
    window.customElements.define(EventDemo.is, EventDemo);

  </script>
</dom-module>
